
tpl1="""
execute at @s if score @s advm_battery_swapper_available matches {id} store result score @s advm_power run data get block ~ ~ ~ Items[{{Slot:{id}b}}].tag.power

"""
tpl2="""
execute at @s if score @s advm_battery_swapper_available matches {id} store result score @s advm_chargeable run data get block ~ ~ ~ Items[{{Slot:{id}b}}].tag.chargeable
execute if score @s advm_chargeable matches 0 if score @s advm_battery_swapper_available matches {id} run loot replace block ~ ~ ~ container.{id} loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute if score @s advm_chargeable matches 1 if score @s advm_battery_swapper_available matches {id} run item modify block ~ ~ ~ container.{id} advm:set_amount
"""
with open("gen.txt","w+") as f:
    for i in range(0,27):
        f.write(tpl1.format(id=str(i)))
    for i in range(0,27):
        f.write(tpl2.format(id=str(i)))
    f.write("scoreboard players set @s advm_battery_swapper_available -1")